package com.cskaoyan.market.admin.controller;

import com.cskaoyan.market.admin.service.AdminRoleService;
import com.cskaoyan.market.db.vo.LabelValue;
import com.cskaoyan.market.util.JacksonUtil;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/admin/role/*")
public class AdminRoleController{
    // 获取AdminRoleController对象
    @Autowired
    private AdminRoleService adminRoleService;
    

    @GetMapping("/options")
    private void options(HttpServletRequest request, HttpServletResponse response) throws IOException {
        List<LabelValue> optionsList = adminRoleService.options();
        Object ok = ResponseUtil.okList(optionsList);
        // 设置响应报文
        String s = JacksonUtil.getObjectMapper().writeValueAsString(ok);
        response.getWriter().println(s);
    }
    
}